package com.zjj.day2.test5;
/**
 * @author zhoujunjie
 * @desc TODO
 * @date 2025/4/18
 */
public class Test {
    public static void main(String[] args) {
        Hero hero = new Hero("勇士", 10, 1000, 200, 100, "人类");
        Monster monster = new Monster("恶龙", 12, 1200, 220, 120, "龙族");
        Equip equip1 = new Equip("宝剑", 5, "银色", "武器", 50, 10);
        Equip equip2 = new Equip("盾牌", 4, "金色", "防具", 10, 30);
        Equip equip3 = new Equip("头盔", 3, "黑色", "防具", 5, 20);

        hero.addEquip(equip1);
        hero.addEquip(equip2);
        hero.addEquip(equip3);

        hero.show();
        monster.show();

        while (!hero.isDead() && !monster.isDead()) {
            hero.attack(monster);
            if (monster.isDead()) {
                System.out.println(monster.getName() + " 已死亡，英雄 " + hero.getName() + " 获胜！");
                break;
            }
            monster.attack(hero);
            if (hero.isDead()) {
                System.out.println(hero.getName() + " 已死亡，怪兽 " + monster.getName() + " 获胜！");
            }
        }
    }
}